home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / NextAnswers / 1312_NXWriteTypes_memory_exception_error.rtf < prev    next >
Text File  |  1995-06-12  |  1KB  |  44 lines

  1. {\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f1\fmodern Courier;\f2\fmodern Ohlfs;}
  2. \paperw11220
  3. \paperh7960
  4. \margl120
  5. \margr1000
  6. {\colortbl;\red0\green0\blue0;\red84\green84\blue84;\red83\green83\blue83;}
  7. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b0\i0\ulnone\fs28\fc0\cf0 Q:  I am using 
  8. \b NXWriteTypes()
  9. \b0  to  archive a character array as follows:\
  10. \
  11.  
  12. \f1\fs24     NXWriteTypes (typedStream, "[32c]", &myCharArray);\
  13.  
  14. \pard\tx620\tx1240\tx1860\tx2480\tx3100\tx3720\tx4340\tx4980\tx5600\tx6220\fc0\cf0 \
  15.  
  16. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\fs28\fc0\cf0 I am following the syntax specified in the documentation, but I consistently get a memory exception error.  Why?\
  17. \
  18. A: The reason is that you are using 
  19. \b NXWriteTypes()
  20. \b0  (plural), which expects multiple types of data, but you only have one single data type.  The fix is to use 
  21. \b NXWriteType()
  22. \b0 :\
  23. \
  24.  
  25. \f1\fs24     NXWriteType(typedStream, "[32c]", &myCharArray)
  26. \f0\fs28 ;\
  27. \
  28. There is another way to archive an array with the specialized NXFunction 
  29. \b NXWriteArray()
  30. \b0 .  The above example would be changed to:\
  31. \
  32.  
  33. \f1\fs24     NXWriteArray(stream, "c",  32, myCharArray);\
  34.  
  35. \f0\fs28 \
  36. Note the different syntax, and see the technical documentation for details on other types of array elements.\
  37. \
  38.  
  39. \fc1\cf1 QA777\
  40. \
  41. Valid for 1.0, 2.0, 3.0\
  42. \
  43.  
  44.